package com.sc.nft.controller;




import com.sc.nft.annotation.UserLogin;
import com.sc.nft.controller.request.IdRequest;
import com.sc.nft.entity.vo.CollectionTransferDetailsVO;
import com.sc.nft.entity.vo.CollectionTransferSimpleListVO;
import com.sc.nft.entity.vo.PropTransferDetailsVO;
import com.sc.nft.entity.vo.PropTransferSimpleListVO;
import com.sc.nft.pool.UserPool;
import com.sc.nft.service.PropGiftLogService;
import com.sc.nft.sup.PageRequest;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 权益道具赠送日志(PropGiftLog)表控制层
 *
 * @author 王伟成
 * @since 2024-03-18 09:58:51
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/propGiftLog")
@Api(tags = "权益道具赠送日志")
public class PropGiftLogController {
    /**
     * 服务对象
     */
    private final PropGiftLogService propGiftLogService;



    @ApiOperation(value = "权益道具转赠简单列表", notes = "权益道具转赠简单列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/collectionTransferSimpleList", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public PageResult<PropTransferSimpleListVO> propTransferSimpleList(@Valid @RequestBody PageRequest pageRequest) {
        return PageResult.success(propGiftLogService.propTransferSimpleList(UserPool.getUser(),pageRequest.toMp()));
    }

    @ApiOperation(value = "根据id获取详情", notes = "根据id获取详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getByIdDetails", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<PropTransferDetailsVO> getByIdDetails(@Valid @RequestBody IdRequest idRequest) {
        return Result.success(propGiftLogService.getByIdDetails(idRequest.getId()));
    }
}
